<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>将单引号替换为双引号</title>
</head>
<body>
<script>
    var text = "He then said 'My Name is O'Connerly, yes that's right O'Connerly'";
    document.write('Original: ' + text + '<br/>');
    var myRegExp = /\B'|'\B/g;
    text = text.replace(myRegExp, '"');
    document.write('Corrected: ' + text);
</script>
</body>
</html>